//
//  RunCardRecordCell.m
//  MRBang
//
//  Created by 铅笔 on 15/12/16.
//  Copyright © 2015年 杭州易网新科技. All rights reserved.
//

#import "RunCardRecordCell.h"

@interface RunCardRecordCell ()

@property (nonatomic,strong) UIView *view_topBG;
@property (nonatomic,strong) UIView *view_buttomBG;

@property (nonatomic,strong) UIImageView *imageView_icon;
@property (nonatomic,strong) UILabel *label_bankName;//银行名
@property (nonatomic,strong) UILabel *label_carType;//卡的类型
@property (nonatomic,strong) UILabel *label_applyStatus;//审核状态

@property (nonatomic,strong) UILabel *label_buttomTop;
@property (nonatomic,strong) UILabel *label_buttomButtom;

@end


@implementation RunCardRecordCell

- (instancetype) initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier
{
    if (self = [super initWithStyle:style reuseIdentifier:reuseIdentifier]) {
        
        [self initWithSubviews];
    }
    return self;
}

- (void) initWithSubviews
{
    // 头部
    self.view_topBG = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kScreenWidth, 80)];
    [self addSubview:self.view_topBG];
    
    //imageview
    self.imageView_icon = [[UIImageView alloc] initWithFrame:CGRectMake(10, 10, 60, 60)];
    [self.view_topBG addSubview:self.imageView_icon];
    self.imageView_icon.layer.cornerRadius = 5.0;
    self.imageView_icon.clipsToBounds = YES;
    
    //银行名
    self.label_bankName = [[UILabel alloc] initWithFrame:CGRectMake(self.imageView_icon.frame.size.width+self.imageView_icon.frame.origin.x+5, self.imageView_icon.frame.origin.y+self.imageView_icon.frame.size.height/2-10, 40, 20)];
    [self.view_topBG addSubview:self.self.label_bankName];
    
    //time
    self.label_carType = [[UILabel alloc] initWithFrame:CGRectMake(kScreenWidth/3, self.label_bankName.frame.origin.y, kScreenWidth/3, 20)];
    [self.view_topBG addSubview:self.self.label_carType];
    self.label_carType.textAlignment = NSTextAlignmentCenter;
    self.label_carType.textColor = RXDColor(132, 132, 132);
    self.label_carType.font = [UIFont systemFontOfSize:14];
    //    self.label_time.backgroundColor = [UIColor redColor];
    
    //状态
    self.label_applyStatus = [[UILabel alloc] initWithFrame:CGRectMake(kScreenWidth*2/3, self.label_carType.frame.origin.y, kScreenWidth/3, 20)];
    [self.view_topBG addSubview:self.self.label_applyStatus];
    //    self.label_applyStatus.backgroundColor = [UIColor greenColor];
    
    self.label_applyStatus.textAlignment = NSTextAlignmentCenter;
    self.label_applyStatus.textColor = RXDColor(132, 132, 132);
    self.label_applyStatus.font = [UIFont systemFontOfSize:14];
    
    //底部
    [self initWithButtomSubviews];
}

- (void) initWithButtomSubviews
{
    self.view_buttomBG = [[UIView alloc] initWithFrame:CGRectMake(0,self.view_topBG.frame.size.height, kScreenWidth, 80)];
    [self addSubview:self.view_buttomBG];
    
    //横线
    UIView *view_line  = [[UIView alloc] initWithFrame:CGRectMake(0,0,kScreenWidth,1.0)];
    [self.view_buttomBG addSubview:view_line];
    view_line.backgroundColor = RXDColor(243, 245, 246);
    
    for (int i=0; i<2; i++) {
        CGFloat view_lineX = kScreenWidth/3;
        UIView *view_line  = [[UIView alloc] initWithFrame:CGRectMake(view_lineX*(i+1),0,1.0,70.0)];
        [self.view_buttomBG addSubview:view_line];
        view_line.backgroundColor = RXDColor(243, 245, 246);
    }
    
    //横线
    UIView *view_lineButtom  = [[UIView alloc] initWithFrame:CGRectMake(0,70,kScreenWidth,10.0)];
    [self.view_buttomBG addSubview:view_lineButtom];
    view_lineButtom.backgroundColor = RXDColor(243, 245, 246);
    
}


- (void) layoutSubviews
{
    self.imageView_icon.image = [UIImage imageNamed:@"b_icbc"];
    self.label_bankName.text = @"工商";
    
    self.label_carType.text = @"年轻黑金卡";
    
    self.label_applyStatus.text = @"完成";
    
    //    self.label_peopleAmount.text = @"985人";
    //    self.label_peopleAmount.textAlignment = NSTextAlignmentCenter;
    //    self.label_peopleAmount.font = [UIFont systemFontOfSize:14];
    //
    //    //    NSString *str = @"985人";
    //
    //    NSMutableAttributedString *AttributedStr = [[NSMutableAttributedString alloc]initWithString:self.label_peopleAmount.text];
    //
    //    [AttributedStr addAttribute:NSFontAttributeName
    //
    //                          value:[UIFont systemFontOfSize:14.0]
    //
    //                          range:NSMakeRange(0,self.label_peopleAmount.text.length)];
    //
    //    [AttributedStr addAttribute:NSForegroundColorAttributeName
    //
    //                          value:RXDColor(132, 132, 132)
    //
    //                          range:NSMakeRange(self.label_peopleAmount.text.length-1,1)];
    //
    //    self.label_peopleAmount.attributedText = AttributedStr;
    
#warning 临时
    NSArray *array_titleTop = @[@"2千－5万元",@"2015-07-23",@"钱*多"];
    NSArray *array_title = @[@"额度",@"申请日期",@"办卡人"];
    
    for (int i=0; i<3; i++) {
        
        CGFloat labelX = kScreenWidth/3;
        self.label_buttomTop = [[UILabel alloc] initWithFrame:CGRectMake(labelX*i, 10, kScreenWidth/3, 30)];
        [self.view_buttomBG addSubview:self.label_buttomTop];
        self.label_buttomTop.text = array_titleTop[i];
        self.label_buttomTop.textAlignment = NSTextAlignmentCenter;
        self.label_buttomTop.font = [UIFont systemFontOfSize:14];
        
        if (i==0) {
            self.label_buttomTop.textColor = [UIColor redColor];
        }
        
        self.label_buttomButtom = [[UILabel alloc] initWithFrame:CGRectMake(labelX*i,self.label_buttomTop.frame.size.height+self.label_buttomTop.frame.origin.y, kScreenWidth/3, 20)];
        [self.view_buttomBG addSubview:self.label_buttomButtom];
        self.label_buttomButtom.text = array_title[i];
        self.label_buttomButtom.textAlignment = NSTextAlignmentCenter;
        self.label_buttomButtom.font = [UIFont systemFontOfSize:14];
        self.label_buttomButtom.textColor = RXDColor(132, 132, 132);
        
    }
    
}

@end
